class Solution {//leetcode122——买卖股票的最佳时机II
public:
    int maxProfit(vector<int>& prices) {
        int n=prices.size();
        int ret=0;
        for(int i=0;i<n-1;i++){
            ret+=max(prices[i+1]-prices[i],0);
        }
        return ret;
    }
};